package org.example.mapper;

import org.apache.ibatis.annotations.Param;
import org.example.pojo.domain.Feedback;

import java.util.List;

public interface FeedbackMapper {
    // 根据展览ID查询所有反馈
    List<Feedback> findByExhibitionId(Integer exhibitionId);
    // 根据反馈ID查询反馈
    Feedback findById(Integer feedbackId);
    // 插入反馈
    void insertFeedback(Feedback feedback);
    // 删除反馈
    void deleteFeedback(Integer feedbackId);
    // 更新反馈
    void updateFeedback(Feedback feedback);
    /**
     * 统计给定用户对某展览的反馈条数
     */
    int countByUserAndExhibition(@Param("userId") Integer userId,
                                 @Param("exhibitionId") Integer exhibitionId);

    /**
     * 查询某用户对某展览的最新一条反馈
     */
    Feedback findLatestByUserAndExhibition(@Param("userId") Integer userId,
                                           @Param("exhibitionId") Integer exhibitionId);
}
